package com.example.Staff.controller;

import com.example.comon.domain.R;
import com.example.Staff.domain.Staff;
import com.example.Staff.service.IStaffService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/staff")
@Api(value = "staff",tags = "员工管理")
public class StaffController {
    @Autowired
    private IStaffService staffService;
    @GetMapping("/getStaffList")
    @ApiOperation("获取人员信息")
    public R<List<Staff>> getStaffList(Staff staff){
        List<Staff> list =  staffService.selectStaff(staff);
        return R.success(list);
    }
    @PostMapping("/addStaff")
    @ApiOperation("增加人员")
    public R<Staff> addStaff(@RequestBody Staff staff){
        staffService.insertStaff(staff);
        return R.success(staff);
    }
    @PutMapping("/updateStaffByStaff_id")
    @ApiOperation("修改人员信息")
    public R updateStaffByStaff_id(@RequestBody Staff staff){
        staffService.updateStaffByStaff_id(staff);
        return R.success();
    }
    @DeleteMapping("/delStaffByStaff_id")
    @ApiOperation("删除人员")
    public R delStaffByStaff_id(String staff_id){
        staffService.delStaffByStaff_id(staff_id);
        return R.success();
    }
}
